package cn.sdhuijin.healthexam.activity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import cn.sdhuijin.healthexam.ExitApplication;
import cn.sdhuijin.healthexam.R;
import cn.sdhuijin.healthexam.control.AbstractControlActivity;
import cn.sdhuijin.healthexam.util.Constants;

/**
 * 健康体检录入-第二页
 * 
 * @author houyuchun
 * 
 */
public class HealthExamSixthActivity extends AbstractControlActivity implements
		OnClickListener {

	private String createDate;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_health_exam_sixth);
		ExitApplication.getInstance().addActivity(this);

		Intent intent = getIntent();
		Bundle bundle = intent.getBundleExtra("bundle");
		if (bundle != null) {
			createDate = bundle.getString("createDate");
		}
		setCurrentEditUserName(createDate);

		addRadioEditUnionView(new int[] { R.id.edt_gangmenzhizhen_qita },
				"肛门指诊", new String[] { "肛门指诊-其他" }, R.id.rad_gangmenzhizhen,
				"其他");
		addRadioEditUnionView(new int[] { R.id.edt_ruxian_qita }, "乳腺",
				new String[] { "乳腺-其他" }, R.id.rad_ruxian, "其他");
		addRadioGroupView(R.id.rad_waiyin, "外阴");
		addRadioGroupView(R.id.rad_yindao, "阴道");
		addRadioGroupView(R.id.rad_gongjing, "宫颈");
		addRadioGroupView(R.id.rad_gongti, "宫体");
		addRadioGroupView(R.id.rad_fujian, "附件");

		addEditTextView(R.id.edt_fuke_qita, "查体其他");
		addEditTextView(R.id.edt_xuehongdanbai, "血红蛋白");
		addEditTextView(R.id.edt_baixibao, "白细胞");
		addEditTextView(R.id.edt_xuexiaoban, "血小板");
		addEditTextView(R.id.edt_xuechanggui_qita, "血常规其他");

		// Properties文件路径
		controlManager.setPropertiesPath(Constants.PROPERTIES_PATH + createDate
				+ ".txt");
		controlManager.toControl();

		this.setButtonListener(this, R.id.btn_next, R.id.btn_previous);
	}

	/**
	 * 按钮点击处理事件
	 */
	@Override
	public void onClick(View arg0) {
		Intent intent = new Intent();
		Bundle bundle = new Bundle();
		// 获取点击按钮
		int id = (Integer) arg0.getId();
		switch (id) {
		case R.id.btn_previous:
			controlManager.toProperties();
			bundle.putString("createDate", createDate);
			// 创建日期
			intent.putExtra("bundle", bundle);
			// 前一页按钮
			intent.setClass(this, HealthExamFifthActivity.class);
			startActivity(intent);
			this.finish();
			break;
		case R.id.btn_next:
			controlManager.toProperties();
			bundle.putString("createDate", createDate);
			// 创建日期
			intent.putExtra("bundle", bundle);
			intent.setClass(this, HealthExamSeventhActivity.class);
			startActivity(intent);
			this.finish();
			break;
		default:
			break;
		}
	}

}
